﻿@{
    ViewBag.Title = "学习资料添加";
}
@{
    ViewBag.Title = "Index";
    var newsType = ViewBag.Modules as IEnumerable<CubicFWNet.Data.Models.NewsType>;
}
<section class="content-header">
    <h1>
        添加学习资料
    </h1>
    <ol class="breadcrumb">
        <li><a href="javascript:void(0);"><i class="fa fa-dashboard"></i>@Resources.Global.PageTitle</a></li>
        <li><a href="@Url.Action("Index","Home")">首页</a></li>
        <li class="active"><a href="@Url.Action("Add", "Learning")">添加学习资料</a></li>
    </ol>
</section>

<section class="content">
    <form class="form-horizontal" method="post" id="formLearning" >
        @*<div class="box box-primary"></div>*@
        <div class="box box-solid">
            <div class="box-body">
                <div class="row">
                    <div class="form-group col-md-6 col-sm-12">
                        <label class="col-sm-3 control-label">名称</label>
                        <div class="col-sm-9">
                            <input type="text" class="form-control" id="Name" name="Name" maxlength="100" required>
                        </div>
                    </div>
                    <div class="form-group col-md-6 col-sm-12">
                        <label for="Type" class="col-sm-3 control-label">类型</label>
                        <div class="col-sm-9">
                            <select class="form-control" id="Type" name="Type">
                                <option value="1">-请选择-</option>
                                @foreach (var type in newsType)
                                {
                                    <option value="@type.Id">@type.TypeName</option>
                                }
                            </select>
                        </div>
                    </div>
                    <div class="form-group col-md-6 col-sm-12">
                        <label class="col-sm-3 control-label">标题</label>
                        <div class="col-sm-9">
                            <input type="text" class="form-control" id="Introduct" name="Introduct" required>
                        </div>
                    </div>
                    <div class="form-group col-md-6 col-sm-12">
                        <label class="col-sm-3 control-label">发布人</label>
                        <div class="col-sm-9">
                            <input type="text" class="form-control" id="Publisher" name="Publisher" required />
                        </div>
                    </div>
                    <div class="form-group col-md-6 col-sm-12">
                        <label class="col-sm-3 control-label">排序</label>
                        <div class="col-sm-9">
                            <input type="number" class="form-control" id="Sort" name="Sort" />
                        </div>
                    </div>
                    <div class="form-group col-md-6 col-sm-12">
                        <label class="col-sm-3 control-label">是否启用</label>
                        <div class="col-sm-9">
                            <input type="checkbox" id="Status" name="Status" checked />
                        </div>
                    </div>
                    <div class="form-group col-md-6 col-sm-12">
                        <label class="col-sm-3 control-label">是否设置权限</label>
                        <div class="col-sm-9">
                            <input type="checkbox" id="IsLimit" name="IsLimit" checked />
                        </div>
                    </div>
                    <div class="form-group col-md-6 col-sm-12 ">
                        <label class="col-sm-3 control-label">内容</label>
                        <div class="col-sm-9">
                            <textarea id="NewsContent" name="NewsContent" rows="10" cols="80" style="visibility: hidden; display: none;">
                                请填写内容
                            </textarea>
                        </div>
                    </div>
                </div>

            </div>
            <div class="box-footer">
                <div class="box-footer">
                    @*创建人：@ViewBag.RealName &nbsp;&nbsp;&nbsp;&nbsp;  创建时间：@DateTime.Now.ToString("yyyy-MM-dd HH:mm")<br /><br />*@
                    <span class="btn btn-primary btn-lg " onclick="FormSub()">提 交</span>&nbsp;&nbsp;&nbsp;&nbsp;
                    <span class="btn btn-primary btn-lg ">返 回</span>
                </div>
            </div>
        </div>
    </form>
</section>
@*@section Styles{

    }*@
@section Scripts{
    <script src="~/Scripts/ckeditor/ckeditor.js"></script>
    <script>
        $(function () {
            // Replace the <textarea id="editor1"> with a CKEditor
            // instance, using default configuration.
            CKEDITOR.replace('NewsContent');
            //bootstrap WYSIHTML5 - text editor
        });

        function FormSub() {
            var name = $("#Name").val().trim();
            if (name == "") {
                $.modalAlert("请输入名称", "warning");
                return false;
            }

            var number = $("#Type").val().trim();
            if (number == "1") {
                $.modalAlert("请输入类型", "warning");
                return false;
            }

            var length = $("#Introduct").val().trim();
            if (length == "") {
                $.modalAlert("请输入标题", "warning");
                return false;
            }

            var width = $("#Publisher").val().trim();
            if (width == "") {
                $.modalAlert("请输入发布人", "warning");
                return false;
            }
            $("#formLearning").submit();
        }
    </script>
}